package cn.edu.scau.cmi.luoxintai.client;

import java.util.*;

import cn.edu.scau.cmi.luoxintai.adapterMethod.ClassAdapter;
import cn.edu.scau.cmi.luoxintai.adapterMethod.ObjectAdapter;
import cn.edu.scau.cmi.luoxintai.adapterMethod.SortUtil;
import cn.edu.scau.cmi.luoxintai.adapterMethod.Student;
import cn.edu.scau.cmi.luoxintai.adapterMethod.Target;

public class AdapterClient  {

	public static void main(String[] args) {
		System.out.printf("Input the students number\n");
		Scanner in  = new Scanner(System.in);
		int numberOfStudent = in.nextInt();
		Student[] array = new Student[numberOfStudent];
		System.out.printf("Input the student's id and his name\n Example: 02 lxt\n");
		for(int i=0;i<numberOfStudent;i++) {
			array[i]=new Student(in.nextInt(),in.next());
		}
		System.out.printf("The list of the information about student:(use the ClassAdapter)\n");
		Target sortC= new ClassAdapter();
		sortC.fastSort(array);
		System.out.printf("--------The end of list--------- \n");
		System.out.printf("The list of the information about student:(use the ObjectAdapter)\n");
		Target sortO =new ObjectAdapter(new SortUtil());
		sortO.fastSort(array);
		System.out.printf("--------The end of list--------- \n");
	}

}